package com.carbeauty.common.enums;

/**
 * 业务状态枚举
 * 
 * @author CarBeauty Team
 */
public enum BusinessStatus {
    
    /**
     * 启用状态
     */
    ACTIVE("ACTIVE", "启用", "正常使用状态"),
    
    /**
     * 禁用状态
     */
    INACTIVE("INACTIVE", "禁用", "暂停使用状态"),
    
    /**
     * 删除状态
     */
    DELETED("DELETED", "已删除", "逻辑删除状态");
    
    private final String code;
    private final String name;
    private final String description;
    
    BusinessStatus(String code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static BusinessStatus fromCode(String code) {
        for (BusinessStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的业务状态代码: " + code);
    }

    /**
     * 检查是否为活跃状态
     *
     * @return 是否为活跃状态
     */
    public boolean isActive() {
        return this == ACTIVE;
    }

    /**
     * 检查是否为禁用状态
     *
     * @return 是否为禁用状态
     */
    public boolean isInactive() {
        return this == INACTIVE;
    }

    /**
     * 检查是否为删除状态
     *
     * @return 是否为删除状态
     */
    public boolean isDeleted() {
        return this == DELETED;
    }
}
